<template>
  <div class="page-container">

    <div v-if="loading" class="loading-overlay">
        <div class="loading-spinner"></div>
        <div class="loading-text">加载中，请稍候...</div>
    </div>

    <!-- 礼品列表 -->
    <div class="project-table">
      <div class="table-header">
        <div class="table-title">礼品列表</div>
        <div class="table-actions">
          <div class="create-button" @click="dialogVisible = true">
            创建礼品
          </div>
        </div>
      </div>
      <el-scrollbar style="margin-bottom: 20px" height="980px">
        <el-table
          :data="giftAllList"
          style="width: 100%"
          :header-cell-style="{
            'text-align': 'center',
            height: '50px',
            color: '#999999',
            'font-size': '15px',
          }"
          :cell-style="{ 'text-align': 'center', height: '70px' }"
        >
          <el-table-column prop="gimg" label="礼品图片">
            <template #default="scope">
              <el-image
                :src="scope.row.gimg"
                style="width: 80px; height: 80px"
              />
            </template>
          </el-table-column>
          <el-table-column prop="gname" label="礼品名称" />
          <el-table-column prop="probability" label="中奖概率">
            <template #default="scope">
              {{ (scope.row.probability / 100).toFixed(2) }}%
            </template>
          </el-table-column>
          <el-table-column prop="stock_type" label="库存类型">
            <template #default="scope">
              {{ getStockTypeName(scope.row.stock_type) }}
            </template>
          </el-table-column>
          <el-table-column prop="level" label="礼品类型">
            <template #default="scope">
              {{ scope.row.level == "1" ? "具体礼品" : "礼品包" }}
            </template>
          </el-table-column>
          <el-table-column prop="pid" label="体验项目">
            <template #default="scope">
              {{
                projectList.find((item) => item.pid === scope.row.pid)?.pname ||
                "-"
              }}
            </template>
          </el-table-column>
          <el-table-column prop="price" label="礼物价值">
            <template #default="scope"> {{ scope.row.price }}元 </template>
          </el-table-column>
          <!-- <el-table-column prop="sort_order" label="排序" /> -->
          <el-table-column label="状态">
            <template #default="scope">
              <el-tag :type="scope.row.status ? 'success' : 'info'">
                {{ scope.row.status ? "启用" : "停用" }}
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column label="操作">
            <template #default="scope">
              <el-button type="text" @click="handleEdit(scope.row)"
                >编辑</el-button
              >
            </template>
          </el-table-column>
        </el-table>
      </el-scrollbar>

      <el-dialog
        v-model="dialogVisible"
        :title="isEdit ? '编辑礼品' : '创建礼品'"
        width="700px"
        :before-close="handleClose"
      >
        <el-form
          ref="formRef"
          :model="formData"
          :rules="formRules"
          label-width="140px"
          size="default"
        >
          <!-- 奖品名称 -->
          <el-form-item label="奖品名称" prop="gname">
            <el-input
              v-model="formData.gname"
              placeholder="请输入奖品名称"
              clearable
            />
          </el-form-item>

          <!-- 奖品图片 -->
          <el-form-item label="奖品图片" prop="gimg">
            <div
              class="image-upload-container"
              style="display: flex; flex-direction: column; align-items: center"
            >
              <el-upload
                class="upload-demo"
                :http-request="handleCustomUpload"
                :before-upload="beforeUpload"
                :show-file-list="false"
                accept="image/*"
                style="width: 100px; height: 100px; position: relative"
              >
                <div v-if="isUploading" class="custom-loading-overlay">
                  <div class="custom-loading-spinner"></div>
                  <div class="custom-loading-text">上传中...</div>
                </div>
                <div
                  v-if="formData.gimg"
                  style="
                    width: 100%;
                    height: 100%;
                    cursor: pointer;
                    position: relative;
                  "
                >
                  <el-image
                    :src="formData.gimg"
                    style="
                      width: 100%;
                      height: 100%;
                      object-fit: cover;
                      border-radius: 4px;
                    "
                  />
                  <div
                    style="
                      position: absolute;
                      bottom: 0;
                      left: 0;
                      right: 0;
                      background: rgba(0, 0, 0, 0.5);
                      color: white;
                      text-align: center;
                      font-size: 12px;
                      padding: 2px 0;
                    "
                  >
                    点击更换
                  </div>
                </div>
                <div
                  v-else
                  class="upload-button-container"
                  style="
                    width: 100%;
                    height: 100%;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    border: 1px dashed #dcdfe6;
                    border-radius: 4px;
                  "
                >
                  <div class="upload-button">
                    <span
                      class="upload-plus"
                      style="font-size: 24px; color: #c0c4cc"
                      >+</span
                    >
                  </div>
                </div>
              </el-upload>
              <div
                class="el-upload__tip upload-tip-wrap"
                style="margin-top: 10px; text-align: center"
              >
                支持JPG、PNG格式，大小不超过2MB
              </div>
            </div>
          </el-form-item>

          <!-- 中奖概率 -->
          <el-form-item label="中奖概率" prop="probability">
            <div style="display: flex; flex-direction: column">
              <el-input-number
                v-model="formData.probability"
                :min="0"
                :max="10000"
                :step="100"
                step-strictly
                placeholder="0-10000之间的整数"
                class="custom-number-input"
              />
              <div class="el-upload__tip upload-tip-wrap">
                数值范围0-10000，代表万分之几的概率
              </div>
            </div>
          </el-form-item>

          <!-- 库存类型 -->
          <el-form-item label="库存类型" prop="stock_type">
            <el-radio-group v-model="formData.stock_type" size="large">
              <el-radio :label="1" class="custom-radio">整个展期库存</el-radio>
              <el-radio :label="2" class="custom-radio">每天库存</el-radio>
              <el-radio :label="3" class="custom-radio">时间段库存</el-radio>
            </el-radio-group>
          </el-form-item>

          <!-- 礼品类型 -->
          <el-form-item label="礼品类型" prop="level">
            <el-select
              v-model="formData.level"
              placeholder="请选择礼品类型"
              clearable
              @change="() => formRef.value?.validateField('box_id')"
            >
              <el-option label="具体礼品" :value="1" />
              <el-option label="礼品包" :value="2" />
            </el-select>
          </el-form-item>

          <!-- 礼品包ID -->
          <el-form-item
            v-if="formData.level == '2'"
            label="礼品包ID"
            prop="box_id"
          >
            <el-select
              v-model="formData.box_id"
              placeholder="请选择礼品包"
              clearable
            >
              <el-option
                v-if="formData.box_id === 0"
                label="请选择礼品包"
                :value="0"
                disabled
              />
              <el-option
                v-for="item in giftBagList"
                :key="item.id"
                :label="item.gname"
                :value="item.id"
              />
            </el-select>
          </el-form-item>

          <!-- 体验项目 -->
          <el-form-item label="体验项目" prop="pid">
            <el-select
              v-model="formData.pid"
              placeholder="请选择体验项目"
              clearable
              required
            >
              <el-option
                v-for="item in projectList"
                :key="item.pid"
                :label="item.pname"
                :value="item.pid"
              />
            </el-select>
          </el-form-item>

          <!-- 礼物价值 -->
          <el-form-item label="礼物价值" prop="price">
            <el-input-number
              v-model="formData.price"
              :min="0"
              :precision="2"
              step-strictly
              placeholder="请输入礼物价值"
              class="custom-number-input"
            />
          </el-form-item>

          <!-- 排序 -->
          <el-form-item label="排序" prop="sort_order">
            <el-input-number
              v-model="formData.sort_order"
              :min="1"
              :max="999"
              step-strictly
              placeholder="数字越小越靠前"
              class="custom-number-input"
            />
          </el-form-item>

          <!-- 状态 -->
          <el-form-item label="状态" prop="status">
            <el-switch
              v-model="formData.status"
              active-text="启用"
              inactive-text="停用"
              :active-value="1"
              :inactive-value="0"
              active-color="#34d399"
              inactive-color="#f87171"
              class="custom-switch"
            />
          </el-form-item>
        </el-form>

        <template #footer>
          <el-button @click="handleClose" class="custom-button cancel-button"
            >取消</el-button
          >
          <el-button
            type="primary"
            @click="submitForm"
            class="custom-button confirm-button"
            >{{ isEdit ? "确认更新" : "确认创建" }}</el-button
          >
        </template>
      </el-dialog>
    </div>
  </div>
</template>

<script setup>
import { ref, reactive, computed, onMounted } from "vue";
import { ElMessage, ElMessageBox } from "element-plus";
import http from "@/libs/http";
import { useRoute } from "vue-router";
const route = useRoute();

const dialogVisible = ref(false);
const isEdit = ref(false);
const formRef = ref(null);
const giftBagList = ref([]); //礼品包数组项
const giftAllList = ref([]); //礼品数组项
const projectList = ref([]); //项目列表数组项
const loading = ref(false);

// 重置表单数据方法
const resetFormData = () => {
  formData.value = {
    gname: "",
    gimg: "",
    probability: 1000,
    stock_type: 1,
    level: "",
    box_id: 0,
    price: 0,
    pid: "",
    sort_order: 1,
    status: 1,
  };
};

const formData = ref({
  gname: "",
  gimg: "",
  probability: 1000,
  stock_type: 1,
  level: "",
  box_id: 0,
  price: 0,
  pid: "",
  sort_order: 1,
  status: 1,
});

const formRules = ref({
  gname: [
    { required: true, message: "请输入奖品名称", trigger: "blur" },
    { min: 2, max: 20, message: "名称长度在2-20个字符之间", trigger: "blur" },
  ],
  gimg: [{ required: true, message: "请上传奖品图片", trigger: "change" }],
  probability: [
    { required: true, message: "请输入中奖概率", trigger: "blur" },
    {
      type: "number",
      min: 0,
      max: 10000,
      message: "请输入0-10000之间的整数",
      trigger: "change",
    },
  ],
  stock_type: [
    { required: true, message: "请选择库存类型", trigger: "change" },
  ],
  level: [{ required: true, message: "请选择礼品类型", trigger: "change" }],
  pid: [{ required: true, message: "请选择体验项目", trigger: "change" }],
  box_id: [
    {
      required: true,
      message: "请选择礼品包",
      trigger: "change",
      validator: (rule, value, callback) => {
        if (formData.value.level == "2" && !value) {
          callback(new Error("请选择礼品包"));
        } else {
          callback();
        }
      },
    },
  ],
  price: [
    { required: true, message: "请输入礼物价值", trigger: "blur" },
    { type: "number", min: 0, message: "价值不能为负数", trigger: "change" },
  ],
  sort_order: [
    { required: true, message: "请输入排序值", trigger: "blur" },
    { type: "number", min: 1, message: "排序值最小为1", trigger: "change" },
  ],
});


// 获取礼品列表
const getGiftList = async () => {
  try {
    const param = {
      token: localStorage.getItem("openid"),
      activity_id: Number(route.query.site),
    };
    loading.value = true;
    const { code, data } = await http.$post(
      "/hd_project/Backend/getGiftLift",
      param
    );
    if (code == 200) {
      loading.value = false;
      // 循环抽离id和gname字段创建新数组
      const newArray = data.map((item) => ({
        id: item.id,
        gname: item.gname,
      }));
      giftBagList.value = newArray;
      giftAllList.value = data.slice().sort((a, b) => a.sort_order - b.sort_order);
      // console.log('>>>>>>>>>>>>>>抽离后的新数组', giftAllList.value);
    } else {
      loading.value = false;
      console.log(">>>>>>>>>获取失败");
    }
  } catch (error) {
    loading.value = false;
    ElMessage.error("获取礼品列表失败");
  }
};

//通过站点的ID,去获取站点的体验项目ID
const getProjectID = async () => {
  try {
    const param = {
      token: localStorage.getItem("openid"),
      activity_id: Number(route.query.site),
    };
    const { code, data } = await http.$post(
      "/hd_project/Backend/getProjectList",
      param
    );
    if (code == 200) {
      // 抽离pid和pname组成新数组
      projectList.value = data.map((item) => ({
        pid: item.id,
        pname: item.play_name,
      }));
      console.log(">>>>>>>>>>>>>拿到项目体验项目数据", projectList.value);
    } else {
      console.log(">>>>>>>>>获取失败");
    }
  } catch (error) {
    ElMessage.error("获取礼品列表失败");
  }
};

const submitForm = async () => {
  try {
    await formRef.value.validate();
    let params = {
      token: localStorage.getItem("openid"),
      activity_id: Number(route.query.site),
      id: isEdit.value ? formData.value.id : 0,
      ...formData.value,
      box_id: formData.value.level === 1 ? 0 : formData.value.box_id
    };
    console.log('>>>>>>>>>>>>>>>请求参数', params)
    // 这里添加表单提交逻辑
    try {
      const { code } = await http.$post("/hd_project/Backend/editGiftDetail", params);
      if (code === 200) {
        ElMessage.success(isEdit.value ? "礼品更新成功" : "礼品创建成功");
        getGiftList(); // 重新获取最新列表
      } else {
        ElMessage.error("操作失败，请重试");
      }
    } catch (error) {
      console.error("接口请求失败:", error);
      ElMessage.error("请求失败，请检查网络");
    } finally {
      resetFormData();
      dialogVisible.value = false;
      isEdit.value = false;
    }
  } catch (error) {
    ElMessage.error("表单验证失败，请检查填写内容");
  }
};

const handleEdit = (row) => {
  // 深拷贝row对象到formData
  Object.assign(formData.value, row);
  // 设置编辑状态
  isEdit.value = true;
  // 打开弹窗
  dialogVisible.value = true;
};

const handleClose = () => {
  resetFormData();
  formRef.value?.resetFields();
  dialogVisible.value = false;
  isEdit.value = false;
};

// 处理图片上传前的检查
// 自定义上传方法：将图片转为base64后调用OSS接口
const isUploading = ref(false);

const handleCustomUpload = async (options) => {
  isUploading.value = true;
  try {
    const file = options.file;
    // 将图片转为base64
    const reader = new FileReader();
    reader.readAsDataURL(file);
    reader.onload = async () => {
      const base64Data = reader.result.split(",")[1]; // 获取base64数据部分
      // 调用接口获取OSS上传路径
      const { code, data: ossPath } = await http.$post(
        "/hd_project/Backend/uploadImg",
        {
          token: localStorage.getItem("openid"),
          sid: Number(route.query.site),
          img: base64Data,
        }
      );
      if (code === 200) {
        // 上传成功后更新表单数据
        // 确保正确提取OSS路径并触发响应式更新
        formData.value.gimg = ossPath; // 处理可能的嵌套路径

        console.log(">>>>>>>>>>>>>上传成功了", ossPath);
        isUploading.value = false;
        options.onSuccess(); // 通知组件上传成功
        ElMessage.success("图片上传成功");
      } else {
        isUploading.value = false;
        options.onError();
        ElMessage.error("获取上传路径失败");
      }
    };
  } catch (error) {
    isUploading.value = false;
    options.onError();
    ElMessage.error("图片上传失败");
  }
};

const beforeUpload = (file) => {
  const isJpgOrPng = file.type === "image/jpeg" || file.type === "image/png";
  const isLt2M = file.size / 1024 / 1024 < 2;

  if (!isJpgOrPng) {
    ElMessage.error("上传图片只能是 JPG/PNG 格式!");
  }
  if (!isLt2M) {
    ElMessage.error("上传图片大小不能超过 2MB!");
  }
  return isJpgOrPng && isLt2M;
};

// 处理编辑弹窗中的图片上传成功事件
// 移除处理编辑弹窗图片上传的函数，统一使用handleImageSuccess

// 提交编辑表单
// 提交编辑表单
// 移除编辑表单提交函数，统一使用submitForm

const getStockTypeName = (type) => {
  const typeMap = {
    1: "整个展期库存",
    2: "每天库存",
    3: "时间段库存",
  };
  return typeMap[type] || type;
};

// 初始化
onMounted(() => {
  getGiftList();
  getProjectID();
});
</script>

<style scoped>
.upload-tip-wrap {
  white-space: normal;
  word-wrap: break-word;
  max-width: 100%;
}
.custom-button {
  padding: 12px 24px;
  font-size: 16px;
  border-radius: 8px;
  font-weight: bold;
}

.cancel-button {
  background: linear-gradient(135deg, #f5f7fa 0%, #e4e4e4 100%);
  border: 1px solid #dcdcdc;
  color: #333;
}

.confirm-button {
  background: linear-gradient(135deg, #409eff 0%, #2979ff 100%);
  border: none;
  color: #fff;
}

.confirm-button:hover {
  background: linear-gradient(135deg, #3a8ee6 0%, #2370db 100%);
}
.custom-radio {
  background: linear-gradient(135deg, #f5f7fa 0%, #e4e4e4 100%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  padding: 6px 12px;
  margin-right: 12px;
}

.custom-radio.is-checked {
  background: linear-gradient(135deg, #e6f7ff 0%, #bae7ff 100%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.custom-number-input {
  --el-input-bg-color: rgba(255, 255, 255, 0.85);
  --el-input-border-color: #e4e7ed;
  --el-input-text-color: #303133;
  --el-input-hover-bg-color: rgba(255, 255, 255, 0.95);
  --el-input-focus-bg-color: #ffffff;
  --el-input-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --el-input-focus-shadow: 0 0 0 2px rgba(144, 147, 153, 0.2);
  --el-input-btn-bg-color: #f2f3f5;
  --el-input-btn-hover-bg-color: #e6e6e6;
}

.custom-number-input .el-input__wrapper {
  background-color: var(--el-input-bg-color);
  border-radius: 8px;
  box-shadow: var(--el-input-shadow);
  transition: all 0.3s ease;
}

.custom-number-input .el-input__wrapper:hover {
  background-color: var(--el-input-hover-bg-color);
  border-color: var(--el-input-border-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.custom-number-input .el-input__wrapper:focus-within {
  background-color: var(--el-input-focus-bg-color);
  border-color: #4096ff;
  box-shadow: var(--el-input-focus-shadow), 0 4px 12px rgba(0, 0, 0, 0.1);
}

.custom-number-input .el-input__suffix {
  padding-right: 8px;
}

.custom-number-input .el-input-number__decrease,
.custom-number-input .el-input-number__increase {
  width: 32px;
  height: 100%;
  background-color: var(--el-input-btn-bg-color);
  border-radius: 0;
  transition: all 0.2s ease;
}

.custom-number-input .el-input-number__decrease:hover,
.custom-number-input .el-input-number__increase:hover {
  background-color: var(--el-input-btn-hover-bg-color);
}

.custom-number-input .el-input-number__decrease {
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
}

.custom-number-input .el-input-number__increase {
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
}

.custom-number-input .el-input-number__decrease.is-disabled,
.custom-number-input .el-input-number__increase.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(64, 150, 255, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(64, 150, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(64, 150, 255, 0);
  }
}

.custom-number-input .el-input__wrapper:focus-within {
  animation: pulse 0.6s;
}

.upload-button-container {
  display: flex;
  flex-direction: column;
}

.upload-button {
  width: 80px;
  height: 80px;
  border: 2px dashed #dcdcdc;
  border-radius: 4px;
  background-color: #f8f8f8;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: all 0.3s ease;
}

.upload-button:hover {
  border-color: #4096ff;
  background-color: #e6f7ff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.upload-plus {
  font-size: 32px;
  color: #909399;
  font-weight: bold;
}

.upload-text {
  margin-top: 10px;
  font-size: 14px;
  color: #909399;
}

.custom-switch {
  --switch-width: 60px;
  --switch-height: 30px;
  --switch-border-radius: 15px;
  --switch-padding: 3px;
  --switch-transition: all 0.3s ease;
}

.custom-switch .el-switch__core {
  width: var(--switch-width);
  height: var(--switch-height);
  border-radius: var(--switch-border-radius);
  padding: var(--switch-padding);
  transition: var(--switch-transition);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.custom-switch .el-switch__core:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.custom-switch .el-switch__core .el-switch__button {
  width: calc(var(--switch-height) - 2 * var(--switch-padding));
  height: calc(var(--switch-height) - 2 * var(--switch-padding));
  border-radius: 50%;
  transition: var(--switch-transition);
}

.custom-switch .el-switch__core.is-active .el-switch__button {
  transform: translateX(calc(var(--switch-width) - var(--switch-height)));
  animation: pulse 0.5s;
}

.custom-switch .el-switch__label {
  font-size: 14px;
  font-weight: 500;
  padding: 0 10px;
}

.custom-switch .el-switch__label.is-active {
  color: #10b981 !important;
  font-weight: bold;
}

.custom-switch .el-switch__label.is-inactive {
  color: #ff4d4f !important;
  font-weight: bold;
}

/* 全屏居中弹窗样式 */
.fullscreen-center-dialog {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.fullscreen-center-dialog .el-dialog {
  margin: 0 !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
}

@keyframes pulse {
  0% {
    transform: translateX(calc(var(--switch-width) - var(--switch-height)))
      scale(1);
  }
  50% {
    transform: translateX(calc(var(--switch-width) - var(--switch-height)))
      scale(1.1);
  }
  100% {
    transform: translateX(calc(var(--switch-width) - var(--switch-height)))
      scale(1);
  }
}

.project-table {
  min-height: 40vh;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  margin: 30px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}
.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background-color: #f8fafc;
  border-bottom: 1px solid #ebeef5;
}
.table-title {
  font-size: 16px;
  font-weight: 600;
  color: #303133;
}

.create-button {
  margin-left: 12px;
  background: var(--el-color-primary);
  background: linear-gradient(135deg, #1e5799 0%, #2989d8 100%);
  border: none;
  color: white;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: all 0.3s;
}

.create-button:hover {
  opacity: 0.9;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(41, 137, 216, 0.3);
}

.custom-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
.custom-loading-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}
.custom-loading-text {
  color: #fff;
  font-size: 14px;
  margin-top: 10px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.page-container {
  position: relative;
  min-height: 78vh;
  padding: 20px;
}

.loading-overlay {
  position: absolute; /* 相对于main-card定位 */
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10; /* 确保覆盖卡片内容 */
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3a7bb8;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.loading-text {
  font-size: 16px;
  color: #3a7bb8;
}
</style>
